//字符串反转，如将字符串 "www.runoob.com" 反转为 "moc.boonur.www"
#include <stdio.h>
void reverse(char* s)
{
    // 获取字符串长度
    int l = 0;
    char* p = s;
    while (*p != 0)
    {
        l++;
        p++;
    }
    
    // 交换 ...
    int i = 0;
    char c;
    while (i <= l / 2 - 1)
    {
        c = *(s + i);
        *(s + i) = *(s + l - 1 - i);
        *(s + l - 1 - i) = c;
        i++;
     }
}
 
int main()
{
    char s[] = "ych";
    printf("'%s' =>\n", s);
    reverse(s);           // 反转字符串
    printf("'%s'\n", s);
    return 0;
}